﻿using Kingdee.BOS;
using Kingdee.BOS.Core.DynamicForm.PlugIn;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PMAF.K3Cloud.SCM.Bill.ServicePlugIn
{
    [HotUpdate]
    [Description("销售出库单保存插件")]
    public class OutStockSave : AbstractOperationServicePlugIn
    {
        public override void BeforeDoSaveExecute(BeforeDoSaveExecuteEventArgs e)
        {
            //校验明细行装车数量与拆分数量是否相等
            //foreach(DynamicObject entity in e.DataEntities)
            //{
            //    DynamicObjectCollection entityEntries = (DynamicObjectCollection)entity["SAL_OUTSTOCKENTRY"];
            //    foreach(DynamicObject entityEntry in entityEntries)
            //    {
            //        int rowIndex = Convert.ToInt32(entityEntry["seq"]);
            //        decimal realQty = Convert.ToDecimal(entityEntry["RealQty"]);
            //        decimal cutQty = Convert.ToDecimal(entityEntry["F_PMAF_CutQty"]);
            //        if(realQty > cutQty || realQty < cutQty)
            //        {
            //            throw new KDBusinessException("error", string.Format("第{0}行", rowIndex));
            //        }
            //    }
            //}
        }
    }
}
